package tests.jdl.databaseObjects;

import jdl.databaseObjects.DbField;
import jdl.databaseObjects.ObjectAlreadyExistsException;
import jdl.databaseObjects.Table;
import jdl.databaseObjects.TableCollection;
import jdl.databaseObjects.datatypes.sqlite.SqliteDbTypeFactory;
import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;

public class TableCollection_Test {
	private TableCollection tableCollection;

	@Before
	public void setUp() {
		tableCollection = new TableCollection();
	}

	@Test
	public void dropTable() throws ObjectAlreadyExistsException {
		Table table = new Table("table");
		DbField field = new DbField("id", SqliteDbTypeFactory.createIntDbType());
		table.getFieldCollection().addField(field);
		tableCollection.add(table);
		tableCollection.dropTable(table);
		Assert.assertEquals(0, tableCollection.getCount());
	}
}
